home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / packet / p_aa4re / bb212src / bbmf3a.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1991-01-20  |  4.8 KB  |  120 lines

  1. (*===========================================================================*)
  2. (* Find/Search -- Forward subroutine                                         *)
  3. (*                                                                           *)
  4. (*   Copyright 1988, 1989, 1990, 1991 by H. Roy Engehausen.  All rights      *)
  5. (*   reserved.                                                               *)
  6. (*                                                                           *)
  7. (*   This software may be freely distributed and used, but it may not        *)
  8. (*   under any circumstances be sold by anyone other than the author.        *)
  9. (*   It may be distributed by a commercial company as long as it is          *)
  10. (*   for no cost.                                                            *)
  11. (*                                                                           *)
  12. (*===========================================================================*)
  13.  
  14. PROCEDURE do_fwd_search;
  15.  
  16.   VAR
  17.     i       : BYTE;
  18.     j       : BYTE;
  19.     msg_dis : msg_d_ptr;
  20.  
  21.   CONST
  22.     no_bbs = '@BLANK';
  23.  
  24.   BEGIN;
  25.  
  26.     WITH our_search, msg_index_current^.msg_i_mb DO
  27.       BEGIN;
  28.  
  29.         (*-------------------------------------------------------------------*)
  30.         (* Check the message number                                          *)
  31.         (*-------------------------------------------------------------------*)
  32.  
  33.         IF msg_number < msg_route_num THEN
  34.           EXIT;
  35.  
  36.         (*-------------------------------------------------------------------*)
  37.         (* Check the distribution list (if any)                              *)
  38.         (*-------------------------------------------------------------------*)
  39.  
  40.         IF (msg_flag AND mf_fwd_list) <> 0 THEN
  41.           BEGIN;
  42.  
  43.             msg_dis := find_dist_list (msg_index_current);
  44.  
  45.             (*-------------------------------------------------------------*)
  46.             (* Here we are about to check the distribution list            *)
  47.             (*-------------------------------------------------------------*)
  48.  
  49.             i := 0;
  50.             j := msg_dis^.msg_d_no;
  51.             REPEAT;
  52.               INC(i);
  53.               WITH msg_dis^.msg_d_array[i] DO
  54.                 BEGIN;
  55.                   IF ((df_fwd AND msg_d_flag) = 0)
  56.                                 AND ((df_fwd_select AND msg_d_flag) = 0) THEN
  57.                     found := match_str(msg_d_info, search_str);
  58.                 END;
  59.             UNTIL found OR (i >= j);
  60.  
  61.             (*-------------------------------------------------------------*)
  62.             (* Search_fi gets set to the index into the distribution list  *)
  63.             (*-------------------------------------------------------------*)
  64.  
  65.             search_fi := i;
  66.  
  67.             (*-------------------------------------------------------------*)
  68.             (* All done!                                                   *)
  69.             (*-------------------------------------------------------------*)
  70.  
  71.             EXIT;
  72.  
  73.           END; (*----- End distribution list address ----------------------*)
  74.  
  75.         (*-------------------------------------------------------------------*)
  76.         (* No distribution list.  Check the TO field if no TOBBS             *)
  77.         (* search_fi = 0 signifying hit in this area.  Note:  If no          *)
  78.         (* TOBBS then we search no further than this check.                  *)
  79.         (*-------------------------------------------------------------------*)
  80.  
  81.         search_fi := 0;
  82.  
  83.         IF LENGTH(msg_to_at) = 0 THEN
  84.           BEGIN;
  85.             IF (LENGTH(search_str) = LENGTH(no_bbs))
  86.                                                AND (search_str = no_bbs) THEN
  87.               found := TRUE
  88.             ELSE
  89.               found := match_str(msg_to, search_str);
  90.             EXIT;
  91.           END;
  92.  
  93.         (*-------------------------------------------------------------------*)
  94.         (* Check the TO BBS field.  If we find it then leave.  Also leave    *)
  95.         (* if the hierarchical address is empty                              *)
  96.         (*-------------------------------------------------------------------*)
  97.  
  98.         found := match_str(msg_to_at, search_str);
  99.  
  100.         IF found OR (msg_to_h = '') THEN
  101.           EXIT;
  102.  
  103.         (*-------------------------------------------------------------------*)
  104.         (* Now the lookup                                                    *)
  105.         (*-------------------------------------------------------------------*)
  106.  
  107.         i := 1;
  108.         REPEAT
  109.           found := match_str(COPY(msg_to_h, i, 255), search_str);
  110.           IF found THEN EXIT;
  111.           INC(i);
  112.           WHILE (i < LENGTH(msg_to_h)) AND (msg_to_h[i] <> '.') DO
  113.             INC(i);
  114.           INC(i);
  115.         UNTIL i >= LENGTH(msg_to_h);
  116.  
  117.       END;
  118.  
  119.   END;
  120.